﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LGCourt.Logic.BLL;
using LGCourt.Logic.Common;
using LGCourt.Logic.NBL.DBEntities;

namespace lgweb.control.inside.department
{
    public partial class IntMenu : System.Web.UI.UserControl
    {
        private string tagIndex = "1";
        private string deptCode = "";
        private string deptID = "0";
        private string detpName = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                this.deptID = string.IsNullOrEmpty(Request.QueryString["deptid"]) ? "0" : Request.QueryString["deptid"].ToString();
                this.tagIndex = string.IsNullOrEmpty(Request.QueryString["cate"]) ? "1" : Request.QueryString["cate"];
                this.deptCode = string.IsNullOrEmpty(Request.QueryString["Code"]) ? "" : Request.QueryString["Code"].ToString();
                SetTagIndex();
                SetClassName();
            }
        }

        private void SetTagIndex()
        {
            this.a_dept_name1.HRef = string.Format("/inside/intColumn/notice.aspx?cate=1&deptid={0}&Code={1}", deptID, deptCode);
            this.a_dept_name2.HRef = string.Format("/inside/intColumn/list.aspx?cate=2&deptid={0}&Code={1}", deptID, deptCode);
            this.a_dept_name3.HRef = string.Format("/inside/intColumn/list.aspx?cate=3&deptid={0}&Code={1}", deptID, deptCode);
            this.a_dept_name4.HRef = string.Format("/inside/intColumn/list.aspx?cate=4&deptid={0}&Code={1}", deptID, deptCode);
            this.a_dept_name5.HRef = string.Format("/inside/intColumn/list.aspx?cate=5&deptid={0}&Code={1}", deptID, deptCode);

            switch (this.tagIndex)
            {
                case "1":
                    this.li_dept_name1.Attributes.Add("class", "current");
                    break;
                case "2":
                    this.li_dept_name2.Attributes.Add("class", "current");
                    break;
                case "3":
                    this.li_dept_name3.Attributes.Add("class", "current");
                    break;
                case "4":
                    this.li_dept_name4.Attributes.Add("class", "current");
                    break;
                case "5":
                    this.li_dept_name5.Attributes.Add("class", "current");
                    break;
                default:
                    this.li_dept_name1.Attributes.Add("class", "current");
                    break;
            }
        }
        private void SetClassName()
        {
            ColInfo colInfoBLL = new ColInfo();
            DeptClassCondition param = new DeptClassCondition();
            param.Name = "监察室栏目";
            List<V_DICT_SOURCE> classInfoList = colInfoBLL.GetDeptSourceList(param);

            this.a_dept_name2.InnerText = classInfoList.Count >= 1 ? classInfoList[0].Source : "工作动态";
            this.a_dept_name3.InnerText = classInfoList.Count >= 2 ? classInfoList[1].Source : "廉政要闻";
            this.a_dept_name4.InnerText = classInfoList.Count >= 3 ? classInfoList[2].Source : "政策法规";
            this.a_dept_name5.InnerText = classInfoList.Count >= 4 ? classInfoList[3].Source : "警钟长鸣";
        }
    }
}